﻿using System;
using Microsoft.LiveFX.ResourceModel;

namespace Wintellect.LiveFx.Cloudboard
{
  public class CloudboardEntry : System.ComponentModel.INotifyPropertyChanged
  {
    private bool isDefault;

    public CloudboardEntry(MeshObjectResource resource, bool isDefault)
    {
      //this.Resource = resource;
      this.Title = resource.Title;
      this.Author = resource.Authors[0].Email;
      this.Created = resource.PublishDate.ToString("d");
      this.LastUpdated = resource.LastUpdatedTime.ToString("g");
      this.isDefault = isDefault;
    }
    public MeshObjectResource Resource { get; private set; }
    public String Title { get; private set; }
    public String Author { get; private set; }
    public String Created { get; private set; }
    public String LastUpdated { get; private set; }
    public Boolean Default 
    {
      get
      {
        return this.isDefault;
      }
      set
      {
        if (this.isDefault != value)
        {
          this.isDefault = value;
          if (this.PropertyChanged != null)
          {
            this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("Default"));
          }
        }
      }
    }

    #region INotifyPropertyChanged Members

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    #endregion
  }
}
